toNotEmptyListOrElse

infix inline fun <E> Array<E>.toNotEmptyListOrElse(defaultValue: (Array<E>) -> NotEmptyList<E>): NotEmptyList<E>

Returns a NotEmptyList containing all the elements of this array, or returns the result of calling the defaultValue function if this array is empty.


infix inline fun <E> Collection<E>.toNotEmptyListOrElse(defaultValue: (Collection<E>) -> NotEmptyList<E>): NotEmptyList<E>

Returns a NotEmptyList containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.